home *** CD-ROM | disk | FTP | other *** search
/ Programming Sound Cards / Programming Sound Cards.iso / sound_52 / ex2.ma < prev    next >
Text File  |  1995-01-01  |  2KB  |  128 lines

  1. # this is a short example that illustrates
  2. # using a continuous controller parameter
  3. # VOLUME to modulate the output of two voices.
  4. #
  5. # Organization:
  6. # vco 1  chords
  7. # vco 2  low chord
  8. # vco 3  ccont volume for vco 1
  9. # vco 4  ccont volume for vco 2
  10. #
  11. # The mos setup must reflect the above organization;
  12. # i.e., set vco 3's midi channel to vco 1
  13. #       set vco 4's midi channel to vco 2
  14. #
  15. # The basis idea is that vco 3 and vco 4 implement
  16. # a rising volume wave.
  17.  
  18.  
  19. # two patches used
  20. LOSTRINGS=4
  21. STRINGS=5
  22.  
  23. # ccont volume param
  24. VOLUME = 7
  25.  
  26. vco vco1sect1
  27.     patch LOSTRINGS
  28. #    void dumpstk(1)
  29.     do
  30.         # 3 measures, F#->E
  31.         F#    0,h    127    
  32.         LE    0,3*w    
  33.         LB    h,3*w    
  34.         E    {3*w}-h
  35.         # 3 measures, LA->LG
  36.         E    0,h    
  37.         LB    0,3*w
  38.         LA    0,3*w
  39.         LD     h,3*w    
  40.         D    {3*w}-h
  41.         # 3 measures    
  42.         D     0,h
  43.         LA    0,3*w
  44.         LG    0,3*w
  45.         LC    h,3*w
  46.         C    {3*w}-h    
  47.         #
  48.         C     0,h
  49.         LA    0,3*w
  50.         LF#    0,3*w
  51.         LLB    h,3*w
  52.         B    {3*w}-h    
  53.     while    4
  54.  
  55. end
  56.  
  57. vco vco2sect1
  58.     patch STRINGS
  59.     do
  60.         LE    w,3*w    127
  61.         LLE    2*w
  62.  
  63.         LD    w,3*w
  64.         LLD    2*w
  65.  
  66.         LC    w,3*w
  67.         LLC    2*w
  68.  
  69.         LLB    w,3*w
  70.         LLLB    2*w
  71.     while    4
  72. end
  73.  
  74. # applied to vco 1
  75. vco vco3sect1
  76.     int remtime
  77.     int remslice
  78.     int i
  79.     int vol1
  80.  
  81.     # rest 12 measures
  82.     do
  83.         rest    w
  84.     while    12
  85.  
  86.     # set volume to zero
  87.     ccont 0     VOLUME     0
  88.     rest    2 * w
  89.  
  90.     # calculate and loop for waves that take 22 measures in all
  91.     # with wave repeating during that time
  92.     remtime = 22 * w
  93.     remslice = remtime / 4
  94.     vol1 = 30
  95.     for ( i = 0; i < remslice; i++)
  96.         if (vol1 >= 127)
  97.             vol1 = 30
  98.         end
  99.         ccont 4    VOLUME    vol1
  100.         vol1 = vol1 + 3
  101.     end
  102. end
  103. # applied to vco 2
  104. vco vco4sect1
  105.     int remtime
  106.     int remslice
  107.     int i
  108.     int vol1
  109.  
  110.     do
  111.         rest    w
  112.     while    12
  113.  
  114.     ccont 0     VOLUME     0
  115.  
  116.     remtime = 22 * w
  117.     remslice = remtime / 4
  118.     vol1 = 30
  119.     for ( i = 0; i < remslice; i++)
  120.         if (vol1 >= 127)
  121.             vol1 = 30
  122.         end
  123.         ccont 4    VOLUME    vol1
  124.         vol1 = vol1 + 3
  125.     end
  126. end
  127.  
  128.